home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 307 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: inforamp.net!usenet
  2. From: pcurran@inforamp.net (Peter Curran)
  3. Newsgroups: comp.lang.c,comp.std.c
  4. Subject: Re: division problem
  5. Date: Mon, 05 Feb 1996 16:44:18 GMT
  6. Organization: PSC Enterprises
  7. Message-ID: <4f5bbt$o41@sam.inforamp.net>
  8. References: <31097D77.11AA@rain.org> <26JAN199622082450@erich.triumf.ca> <4eh246$u6h@airdmhor.gen.nz> <4ej4ha$66@fountain.mindlink.net> <DLzvGG.2rn@uns.bris.ac.uk> <Pine.SOL.3.90.960130150923.21923F-100000@flute> <4etjdj$fil@airdmhor.gen.nz> <mjs.823295100@hubcap> <TANMOY.96Feb3095531@qcd.lanl.gov>
  9. Reply-To: pcurran@inforamp.net
  10. NNTP-Posting-Host: ts44-03.tor.inforamp.net
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. On 03 Feb 1996 16:55:31 GMT in article <TANMOY.96Feb3095531@qcd.lanl.gov>
  14.     tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) (Tanmoy Bhattacharya) wrote:
  15.  
  16. >Note cross post to comp.std.c
  17.  
  18. >In article <mjs.823295100@hubcap> mjs@hubcap.clemson.edu
  19. >(M. J. Saltzman) writes: 
  20. ><snip>
  21. >   >#if -3 / 2 == -2
  22. ><snip>
  23. >   I'm not so sure.  Is there a guarantee that the division as done in
  24. >   the compiler's preprocessing phase will give the same result as the
  25. >   division done at run time?  Language lawyers?
  26.  
  27. >The standard seems silent as to this: except that it says that all
  28. >integer arithmetic is done as on longs. The interpretation of character
  29. >constants is explicitly permitted to be different. As otherwise the
  30. >rules of expression evaluation are quoted, I would say other
  31. >things cannot be different ... but I doubt whether that was intended.
  32.  
  33. I asked a similar question a few years ago - can the preprocessor work in 1's
  34. complement while the runtime system works in 2's complement.  The consensus was
  35. yes (modulo the separate question of whether a 1's complement implementation of
  36. the arithmetic rules is really possible/practical).
  37.  
  38. --
  39. Peter Curran                               pcurran@inforamp.net
  40.  
  41.